<!-- 考勤统计 -->
<template>
  <vxe-grid
    ref="vxeTable1"
    border
    resizable
    :loading="loading"
    max-height="300"
    :toolbar-config="tableToolbar"
    :edit-config="{trigger: 'click', mode: 'row'}"
    :columns="tableColumn"
    :data="tableData">
    <template v-slot:toolbar_buttons>
      <a-button type="primary" icon="plus" @click="handleAdd">新增</a-button>
      <a-dropdown v-if="selectedRowKeys.length > 0">
        <a-menu slot="overlay">
          <a-menu-item key="1" @click="batchDel"><a-icon type="delete" />删除</a-menu-item>
        </a-menu>
        <a-button>批量操作<a-icon type="down" /></a-button>
      </a-dropdown>
    </template>
  </vxe-grid>
</template>
<script >
import moment from 'moment'
import { postActionQs } from '@/api/manage'
import JSelectUserByDep from '@/components/jeecgbiz/JSelectUserByDep'
export default {
  name:'SalaryItemTable',
  components: {
    JSelectUserByDep
  },
  data() {
    return {
      loading: false,
      queryParam: {
        month: ''
      },
      tableToolbar: {
        print: true,
        zoom: true,
        slots: {
          buttons: 'toolbar_buttons'
        }
      },
      tableColumn: [
        { type: 'checkbox', width: 50 },
        { type: 'seq', width: 60 },
        { field: '8', title: '薪资构成' },
        { field: '1', title: '计算方式', editRender: { name: '$select', options: [] } },
        { field: '2', title: '执行金额/标准',editRender: { name: '$input', props: { type: 'number' } }},
        { field: '7', title: '发放周期', editRender: { name: '$select', options: [] }  },
        { field: '6', title: '备注' ,editRender: { name: '$input' }}
      ],
      tableData: [],
      selectedRowKeys:[],
      url: {
        list: '/wx/cp/oa/getCheckinMonthData',
        list2: '/wx/cp/oa/getCheckinDayData'
      }
    }
  },
  created() {
    this.loadData(1)
  },
  methods: {
    loadData(arg) {
      // 加载数据 若传入参数1则加载第一页的内容
      this.loading = true
      setTimeout(() => {
        this.loading = false
        this.tableData = [{},{},{},{},{},{}]
      },1000)
      return false
      postActionQs(this.url.list2, param).then(res => {
        console.log(JSON.stringify(res.result.datas))
        this.loading = false
        this.tableData = res.result.datas
      })
    },
    handleEdit(data){
      this.$refs.salaryUserModal.edit({})
    },
    handleAdd(data){
      this.$refs.salaryUserModal.add()
    },
    handleDelete(data){
      console.log(data)
    },
    batchDel(){

    }
  }
}
</script>
